import 'package:flutter/material.dart';

/// An item which is typically used in bottom sheet list.
/// It contains a central [titile] with a optional left side [icon].
class CentralTitleListItem extends StatelessWidget {
  const CentralTitleListItem({
    super.key,
    required this.title,
    this.icon,
    this.onTap,
  });

  final String title;
  final Icon? icon;
  final GestureTapCallback? onTap;

  @override
  Widget build(BuildContext context) {
    return ListTile(
      title: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          if (icon != null)
            Row(
              children: [
                icon!,
                const SizedBox(width: 10.0),
              ],
            ),
          Text(title),
        ],
      ),
      onTap: onTap,
    );
  }
}
